#ifndef ENTITIES_H
#define ENTITIES_H
#include <SFML/Graphics.hpp>
#include <vector>
#include "Utils.h"

using namespace sf;
using namespace std;


class GameManager;

class Entity
{
public:
	enum EType			// Entity type; determines physics and control settings.
	{
		GENERIC,
		PROJECTILE,
		PLAYER,
		ENEMY,
		WALKABLE,
		BLOCKABLE
	};

	enum CType			// Content type; trickles down to determine EType. Specifically affects image settings.
	{
		HUMAN,
		ZOMBIE,
		BULLET,
		HSTREET,
		VSTREET,
		INTERSECTION,
		BUILDING
	};
	Entity(CType, const GameManager&, Vector2f = Vector2f(0, 0));
	virtual void Update(float);
	virtual EType Type() const;
	
	void Damage(int);
	void Move(Vector2f);
	Vector2f Position() const;
	void Position(const Vector2f&);
	Vector2f Velocity() const;
	Vector2f Scale() const;
	Vector2f Target() const;
	int Health() const;
	int Speed() const;
	bool Alive() const;
	Vector2f SpriteSize() const;
	
	
private:
	EType type;
	Vector2f position, lastposition, velocity, scale, target;
	int health, uFrequency, uSkipped;
	float rotation, speed;
	bool alive;
	Sprite sprite;
	const GameManager& manager;
};

class Projectile : public Entity
{
public:
	Projectile(CType, const GameManager&, Entity&);
	void Reset();
	void Fire();
private:
	Entity parent;
};

class Player : public Entity
{
public:
	Player(CType, const GameManager&, Vector2f = Vector2f(0, 0));
	void Update(float);
	EType Type() const;
	vector<Projectile*> Bullets();
	Projectile* CurrentBullet();
	void Fire();
private:
	vector<Projectile*> bullets;
	int currentbullet;
};

class Enemy : public Entity
{
public:
	Enemy(CType, const GameManager&, Vector2f = Vector2f(0, 0));
	void Update(float);
	EType Type() const;
	
private:

};

class Scenery : public Entity
{
public:
	Scenery(CType, const GameManager&, Vector2f = Vector2f(0, 0));
	void Update(float);
	EType Type() const;
	
private:
	
};

/*
//-----------------------------------------------------------------------------------------------------------------------------------------------
class Entity
{
protected:
	Vector2f position;
	Vector2f lastPosition;
	FloatRect area;
	Vector2f velocity;
	Vector2f scale;
	float rotation;
	bool alive;
	int health;
	float speed;
	int uFrequency;
	int uSkipped;
	bool mobile;
	bool collideLast;
	Vector2f target;
	Sprite sprite;
	GameManager* manager;
	vector<Entity*>* eList;
	void init(Image&);
	virtual void collision(Entity&);
public:
	Entity(Image&, GameManager*, Vector2f = Vector2f(0, 0));

	virtual void update(float);

	void faceAngle(float);
	void facePoint(Vector2f);
	void faceEntity(Entity&);
	bool isColliding(Entity&);

	void Damage(int);
	void Damage();
	virtual EType Type();
	void Move(Vector2f);
	Vector2f Scale();
	void Scale(Vector2f);
	float Speed();
	void Speed(float);
	float Rotation();
	void Rotation(float);
	int Health();
	void Health(int);
	bool Alive();
	void Alive(bool);
	bool Mobile();
	void Mobile(bool);
	Vector2f Position();
	void Position(Vector2f);
	FloatRect Area();
	void Area(FloatRect);
	Vector2f Velocity();
	void Velocity(Vector2f);
	Vector2f Target();
	void Target(Vector2f);
	Sprite eSprite();
	void eSprite(Sprite);
	void UpdateFrequency(int);
};

class Bullet : public Entity
{
protected:
	Entity* parent;
	void collision(Entity&);
public:
	Bullet(Image&, GameManager*, Entity*);
	void Reset();
	void Fire();
	EType Type();
};

class Player : public Entity
{
protected:
	std::vector<Bullet*> bullets;
	int currentBullet;
	void collision(Entity&);
public:
	Player(Image&, GameManager*, Vector2f = Vector2f(0, 0));
	void update(float);
	void initBullets(Image&);
	std::vector<Bullet*> Bullets();
	Bullet* CurrentBullet();
	void Fire();
	EType Type();
};

class Enemy : public Entity
{
protected:
	Entity * player;
	void collision(Entity&);
public:
	Enemy(Image&, GameManager*, Vector2f = Vector2f(0, 0), Entity * = 0);
	void update(float);
	Entity * PlayerPtr();
	void PlayerPtr(Entity *);
	EType Type();
};

class Scenery : public Entity
{
protected:
	void collision(Entity&);
public:
	Scenery(Image&, GameManager*, Vector2f = Vector2f(0, 0));
	EType Type();
};*/
#endif
